import request from '@/utils/request';

// 获取当前用户基本信息

export const fetchUserInfo = () => {
  return request('/admin/user', {
    method: 'GET',
  });
};

// 获取用户列表
export const fetchUserList = (params: any) => {
  return request('/admin/users', {
    method: 'GET',
    params,
  });
};

// 修改禁用状态
export const fetchUserLock = (userId: number) => {
  return request(`/admin/users/${userId}/lock`, {
    method: 'PATCH',
  });
};

// 新增用户
export const fetchUserAdd = (data: any) => {
  return request('/admin/users', {
    method: 'POST',
    data,
  });
};

// 用户详情
export const fetchUserData = (id: number) => {
  return request(`/admin/users/${id}`, {
    method: 'GET',
  });
};

// 用户更新
export const fetchUserUpdata = (id: number, data: any) => {
  return request(`/admin/users/${id}`, {
    method: 'PUT',
    data,
  });
};
